﻿@using ActivityReservation.Models
@model IPagedListModel<ActivityReservation.ViewModels.ReservationListViewModel>
@{
    Layout = null;
}
@if (Model.Data != null && Model.Data.Count > 0)
{
    <table class="table table-hover">
        <thead>
            <tr>
                <th>活动室名称</th>
                <th>预约使用日期</th>
                <th>预约使用时间</th>
                <th>预约单位</th>
                <th>活动内容</th>
                <th>预约人姓名</th>
                <th>预约人联系方式</th>
                <th>预约时间</th>
                <th>审核状态</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.Data)
            {
                string status = "待审核", className = "";
                switch ((int)item.ReservationStatus)
                {
                    case 0:
                        status = "待审核";
                        className = "";
                        break;
                    case 1:
                        status = "审核通过";
                        className = "bg-success";
                        break;
                    case 2:
                        status = "审核未通过";
                        className = "bg-danger";
                        break;
                    default:
                        break;
                }
                <tr class="@className">
                    <td>
                        @item.ReservationPlaceName
                    </td>
                    <td>
                        @item.ReservationForDate.ToString("yyyy-MM-dd")
                    </td>
                    <td>
                        @Html.Raw(item.ReservationForTime.Replace(",", "<br />"))
                    </td>
                    <td>
                        @item.ReservationUnit
                    </td>
                    <td>
                        @item.ReservationActivityContent
                    </td>
                    <td>
                        @(WeihanLi.Common.Helpers.StringHelper.HideSensitiveInfo(item.ReservationPersonName, 1, 0, 2))
                    </td>
                    <td>
                        @(WeihanLi.Common.Helpers.StringHelper.HideTelDetails(item.ReservationPersonPhone))
                    </td>
                    <td>
                        @item.ReservationTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss")
                    </td>
                    <td>
                        @Html.Raw(status)
                    </td>
                    <td>
                        @if (item.ReservationStatus == ReservationStatus.Reviewed)
                        {
                            <button type="button" class="btn btn-default" onclick="view('@item.ReservationId')">查看</button>
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>
    @Html.Pager(Model.Pager, pageIndex => String.Format("javascript:loadData({0})", pageIndex), "PagerPartial", PagingDisplayMode.IfNeeded)
}
else
{
    <div class="nodata-tip">
        暂时没有数据.
    </div>
}